package edu.egypt.notificationmanager;

import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

//objective 1 : set up notification message
public class NotificationManagerSampleActivity extends Activity {
    private Button button;
	private NotificationManager notificationManager;
	private Notification notification;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        notificationManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
        notification = new Notification(R.drawable.egypt,"Notification Title", System.currentTimeMillis()+2000);
        //later
		Intent intent = new Intent(this,NotificationManagerSampleActivity.class);
		PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent , 0);
		notification.setLatestEventInfo(this, "Notification Title 2", "Text of the notification goes here .......", contentIntent);
		
		
        button = (Button)findViewById(R.id.button1);
        button.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				notificationManager.notify(1, notification);
				
			}
		});
        
        
        
        
        
    }

	@Override
	protected void onResume() {
		super.onResume();
		//later
		notificationManager.cancel(1);
	}
}